#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
using namespace std;
typedef long long ll;
const int N=100010;
ll res[N];
int sum[N];
int a[N];
int main()
{
	int n,k;
	cin>>n>>k;
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		sum[i]=(sum[i-1]+a[i])%k;
		ans+=res[sum[i]];
		res[sum[i]]++;
	}
	cout<<res[0]+ans;

	return 0;
}

